//package org.liuyunfeng.interceptor;
//
//import org.springframework.http.HttpStatus;
//import org.springframework.stereotype.Component;
//import org.springframework.util.StringUtils;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * @description:
// * @author: TanJingyu
// * @create: 2022-01-07 15:17
// **/
//@Component
//public class BasicInterceptor implements HandlerInterceptor {
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        String authorization = request.getHeader("Authorization");
//        if (StringUtils.isEmpty(authorization) || !"basic cXJjb2RlOnFyY29kZQ==".equalsIgnoreCase(authorization)) {
//            response.setStatus(HttpStatus.UNAUTHORIZED.value());
//            response.setHeader("WWW-Authenticate", "Basic realm=enterprise_selection_qrcode");
//            return false;
//        }
//        return true;
//    }
//
//    @Override
//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//
//    }
//
//    @Override
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//
//    }
//}
//